package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.TemplateDetailDao;
import com.xtedu.examproject.dao.impl.TemplateDetailDaoImpl;
import com.xtedu.examproject.entity.TemplateDetail;

import java.util.List;

/*
 * Author: xzy
 * Date: 2025/10/16
 * Last Modified by: xzy
 * Last Modified date: 2025/10/16
 * Description: TODO - Add file description here
 */
public class TemplateDetailService {
    private final TemplateDetailDao templateDetailDao;

    public TemplateDetailService() {
        templateDetailDao = new TemplateDetailDaoImpl();
    }

    public int insert(TemplateDetail templateDetail) throws Exception {
        return templateDetailDao.insert(templateDetail);
    }

    public int update(TemplateDetail templateDetail) throws Exception {
        return templateDetailDao.update(templateDetail);
    }

    public int delete(TemplateDetail templateDetail) throws Exception {
        return templateDetailDao.delete(templateDetail);
    }

    public int deleteById(int id) throws Exception {
        return templateDetailDao.deleteById(id);
    }

    public TemplateDetail findById(int id) throws Exception {
        return templateDetailDao.findById(id);
    }

    public List<TemplateDetail> findAll() throws Exception {
        return templateDetailDao.findAll();
    }

    public List<TemplateDetail> findByTemplateId(int templateId) {
        return templateDetailDao.findByTemplateId(templateId);
    }
}
